﻿@{
    ViewBag.Title = "流程管理";
    Layout = "~/Areas/Member/Views/Shared/_Layout.cshtml";
}
<div class="layui-tab layui-tab-brief" lay-filter="user">
    <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 5px 0;">
        <form action="" class="layui-form">
            <div class="layui-inline">
                <label class="layui-form-label" style="width: auto; padding-right: 5px;">名称筛选：</label>
                <div class="layui-input-inline">
                    <input type="text" name="keyWord" class="layui-input" value="">
                </div>
            </div>
            <div class="layui-inline">
                <button type="button" class="layui-btn searchButton">搜索</button>
            </div>
        </form>
    </div>
    <table class="layui-table" lay-data="{url:'GetData', cellMinWidth: 80, page: false,limit:200}" id="resultList" lay-filter="resultList">
        <thead>
            <tr>
                <th lay-data="{field:'ID', width:80}">ID</th>
                <th lay-data="{field:'Name'}">名称</th>
                <th lay-data="{fixed:'right', width:300, align:'center', toolbar: '#barDemo'}">操作</th>
            </tr>
        </thead>
    </table>


    <script type="text/html" id="barDemo">
        {{# if(d.ID!=0){ }}
        <a class="layui-btn layui-btn-primary layui-btn-xs" lay-href="/Management/ApprovalTree/ShowPreApprovalTree?id={{d.ID}}">前置流程</a>
        {{# } }}
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:InitByOrganization({{d.ID}})">按组织机构初始化</a>
        <a class="layui-btn layui-btn-primary layui-btn-xs" lay-href="/Management/ApprovalTree/ShowTree?id={{d.ID}}" lay-text="查看{{d.Name}}流程">查看流程</a>
    </script>

</div>

<script type="text/javascript">
    function InitByOrganization(id) {
        layer.confirm('您正在按组织架构初始化审批流程。<p style="color:red;">原始数据将会被删除，并不可以恢复</p>', {
            btn: ['是的,我要初始化', '不小心点错了'] //按钮
        }, function () {
            var url = "/Management/ApprovalTree/InitByOrganization?id=" +id;
            $.getJSON(url, function (data) {
                if (data.State === 200) {
                    layer.msg("审批流程初始化成功!");
                }
                else {
                    layer.msg(data.Message);
                }
            });
        }, function () {

        });
    }
</script>


